#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dominion.h"

void testing(struct gameState *game);

int main(int argc, char *argv[]){
	struct gameState *game = malloc(sizeof(struct gameState));
	testing(game);
	free(game);
	return 0;
}

void testing(struct gameState *game){
	struct gameState *after = malloc(sizeof(struct gameState));

	int h_size = 0;
	
	int i;
	for(int i = 0; i < 10; i ++){
		h_size = (rand() % 10) + 5;
		int j;
		for(j = 0; j < h_size; j++){//tests the setting of player decks
			game->deck[0][j] = rand() % 27;
			game->deckCount[0]++;
		}
		memcpy(after, game, sizeof(struct gameState));
		int k;
		for(k = 0; k <= MAX_PLAYERS; k++){
			shuffle(k, game);//shuffle function defined in dominion.h
		}

		printf("Size of Hand = %d\n", h_size);
		
		if(memcmp(game, after, sizeof(struct gameState)) == 0){
			printf("Unit Test 1 FAILED deck initialization failed.\n");
		}
		else{
			printf("Test PASSED players ready to play.\n");
		}
	}
	free(after);
	return;
}